package com.leyou.trade.interceptors;

import com.leyou.auth.constants.JwtConstants;
import com.leyou.auth.local.UserContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

@Component
public class FeignInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate requestTemplate) {
        //给请求添加请求头
        requestTemplate.header("Cookie", JwtConstants.COOKIE_NAME + "=" + UserContext.getJwt());
    }
}
